local taishi = fk.CreateSkill{
  name = "rmt__taishi",
  tags = { Skill.Lord },
}

Fk:loadTranslationTable{
  ["rmt__taishi"] = "泰始",
  [":rmt__taishi"] = "主公技，你的回合外，当前回合角色每回合首次使用牌时，其可以将使用者改为你，若为秦势力角色，删去「每回合首次」。",

  ["#rmt__taishi-invoke"] = "泰始：你可以将使用的 %arg 的使用者改为 %dest",
}

taishi:addEffect(fk.CardUsing, {
  anim_type = "support",
  can_trigger = function (self, event, target, player, data)
    local current = player.room.current
    if player:hasSkill(taishi.name) and player ~= current and current == target then
      return current.kingdom == "qin" or #player.room.logic:getEventsOfScope(GameEvent.UseCard, 2, function (e)
        return e.data.from == current or (e.data.extra_data and e.data.extra_data.rmt__taishi == current)
      end, Player.HistoryTurn) == 1
    end
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    return room:askToSkillInvoke(room.current, {
      skill_name = taishi.name,
      prompt = "#rmt__taishi-invoke::"..player.id..":"..data.card:toLogString(),
    })
  end,
  on_use = function (self, event, target, player, data)
    data.extra_data = data.extra_data or {}
    data.extra_data.rmt__taishi = data.from
    data.from = player
  end
})

return taishi